<!DOCTYPE html>
<html lang="en">
<head>
    <meta c harset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>作用域</title>
</head>
<body>
    <!-- 状态showChild绑定的是父组件的数据 -->
    <div id="app">
        <child-component v-show="showChild"></child-component>
    </div>
    <!-- 状态showChild绑定的是子组件的数据 -->
    <div id="app-2">
        <child-component></child-component>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
    <script>
        Vue.component('child-component',{
            template:'<div>子组件</div>'
        });
        
        var app = new Vue({
            el:"#app",
            data:{
                showChild:true
            }
        })
    </script>    
    <script>
        Vue.component('chile-component',{
            template:'<div>子组件</div>',            
            data:function(){
                return{
                    showChild:true
                }
            }
        })

        var app2 = new Vue({
            el:'#app-2'
        }) 
    </script>
</body>
</html>